//
//  TopicListCell.m
//  BaseProject
//
//  Created by 王洋 on 2020/12/11.
//  Copyright © 2020 王洋. All rights reserved.
//

#import "TopicListCell.h"

@implementation TopicListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

+ (CGFloat)calculateHeight {
    return 115;
}

- (void)fillWithModel:(CommonPostModel *)model {
    
    self.timeLab.text = model.createTime;
    self.mainTitleLab.text = model.themeTitle;
    self.contentLab.text = model.content;
    
    [self.evaBtn setTitle:[NSString stringWithFormat:@" %ld",(long)model.replyCount] forState:UIControlStateNormal];
    [self.thumbBtn setTitle:[NSString stringWithFormat:@" %ld",(long)model.likes] forState:UIControlStateNormal];
    
    if (model.isZan.length > 0) {
        [self.thumbBtn setImage:[UIImage imageNamed:@"tanhun_zan_sel"] forState:UIControlStateNormal];
        [self.thumbBtn setTitleColor:UIColorHex(0xFF4242) forState:UIControlStateNormal];
    } else {
        [self.thumbBtn setImage:[UIImage imageNamed:@"tanhun_zan"] forState:UIControlStateNormal];
        [self.thumbBtn setTitleColor:UIColorHex(0x333333) forState:UIControlStateNormal];
    }
    
}

//评价按钮
- (IBAction)evaluateAction:(id)sender {
    if (self.TopicListSectionHeaderBlock) {
        self.TopicListSectionHeaderBlock(CommunityActionType_Eva);
    }

}

//点赞按钮
- (IBAction)thumbAction:(id)sender {
    if (self.TopicListSectionHeaderBlock) {
        self.TopicListSectionHeaderBlock(CommunityActionType_Thumb);
    }
}

@end
